package com.yoki.loginview.AdapterView;

import android.content.Context;
import android.graphics.Color;
import android.text.Layout;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.SimpleAdapter;

import com.yoki.loginview.R;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class SpecialAdapter extends SimpleAdapter {
    View layout;
    List<Map<String, Object>> data;

    public SpecialAdapter(Context context, List<Map<String, Object>> data, int resource, String[] from, int[] to) {
        super(context, data, resource, from, to);
        this.data = data;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent)
    {
        View view = super.getView(position, convertView, parent);
        //Log.d("class",data.get(position).getClass());
        if(data.get(position).get("color")!=null)
        {
            int color = Integer.parseInt(data.get(position).get("color").toString());
            layout = view.findViewById(R.id.layout);
            view.setBackgroundResource(color);
        }
        return view;
    }
}
